package com.gzck.gzck_verson2.controller;


import com.gzck.gzck_verson2.pojo.GProjectIndustryParatype;
import com.gzck.gzck_verson2.service.IGProjectIndustryParatypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 行业参数类型中间表 前端控制器
 * </p>
 *
 * @author 任永辉
 * @since 2024-01-27
 */
@RestController
@RequestMapping("/g-project-industry-paratype")
public class GProjectIndustryParatypeController {

    @Autowired
    private IGProjectIndustryParatypeService industryParatypeService;

    // 添加行业参数类型
    @PostMapping("/add")
    public boolean addIndustryParatype(@RequestBody GProjectIndustryParatype industryParatype) {
        return industryParatypeService.save(industryParatype);
    }

    // 删除行业参数类型
    @DeleteMapping("/delete/{id}")
    public boolean deleteIndustryParatype(@PathVariable Long id) {
        return industryParatypeService.removeById(id);
    }

    // 更新行业参数类型信息
    @PutMapping("/update")
    public boolean updateIndustryParatype(@RequestBody GProjectIndustryParatype industryParatype) {
        return industryParatypeService.updateById(industryParatype);
    }

    // 查询单个行业参数类型信息
    @GetMapping("/{id}")
    public GProjectIndustryParatype getIndustryParatype(@PathVariable Long id) {
        return industryParatypeService.getById(id);
    }

    // 查询所有行业参数类型信息
    @GetMapping("/all")
    public List<GProjectIndustryParatype> getAllIndustryParatypes() {
        return industryParatypeService.list();
    }
}
